package com.splant.android.smart.UILevel.Community.fragments;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.splant.android.R;
import com.splant.android.smart.ModelLevel.AreaListBean;

import java.util.List;

/**
 * Created by Administrator on 2017/8/3.
 */

public class Garden_AreaList_Adapter extends BaseAdapter {

    private List<AreaListBean.Area> areaList;
    private LayoutInflater inflater;

    public Garden_AreaList_Adapter(Context context, List<AreaListBean.Area> areaList) {
        inflater = LayoutInflater.from(context);
        this.areaList = areaList;
    }

    @Override
    public int getCount() {
        return areaList.size();
    }

    @Override
    public Object getItem(int position) {
        return areaList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        ViewHolder viewHolder;
        if (convertView == null) {

            convertView = inflater.inflate(R.layout.system_list_item0, null);// 生成条目对象
            viewHolder=new ViewHolder();
            viewHolder.tv_areaName= (TextView) convertView.findViewById(R.id.tv_value);

            convertView.setTag(viewHolder);
        }
        else
        {
            viewHolder= (ViewHolder) convertView.getTag();
        }
        viewHolder.tv_areaName.setText(areaList.get(position).getAreaName());



        return convertView;
    }
    public class ViewHolder
    {
        public TextView tv_areaName;
    }


}
